﻿@page "/Page1"
@using Console = System.Console

<Switch ValueChanged="@OnValueChanged" OnColor="Color.Secondary" OnText="开启" OffText="关闭"></Switch>
<BootstrapInput @bind-Value="@_text" IsDisabled="@_isDisabled"></BootstrapInput>

<div class="row">
    <div class="form-group col-12">
        <Select style="width:100%" Items="Catalogs" TValue="string" ShowLabel="true" DisplayText="分类" OnSelectedItemChanged="(p) => OnChange(p, 1)"></Select>
    </div>
</div>

@code {

    private bool _isDisabled = false;

    private string _text;

    private List<SelectedItem> Catalogs = new List<SelectedItem>() {new SelectedItem("1", "1"),new SelectedItem("2", "2")};

    protected override void OnInitialized()
    {
        base.OnInitialized();
    }

    internal class Product
    {

        /// <summary>
    /// 
    /// </summary>
        public string Description { get; set; } = "";
    }

    private void OnValueChanged(bool obj)
    {
        _isDisabled = obj;
    }

    private Task OnChange(SelectedItem selectedItem, int i)
    {
        Console.WriteLine(i);
        return Task.CompletedTask;
    }

}